<%@page import="Model.User"%>
<%@page import="Model.UserDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/headeradmin.jspf" %>

<script type="text/javascript">
   function xacnhan(){
	   return confirm('Bạn thực sự muốn sửa Người dùng này?');
   }
    </script>
<%
String user = request.getParameter("user");
User layRole = new UserDAO().layRole(user);                
                String selc_1 = "";
                String selc_2 = "";                
                if(layRole.getRole().equalsIgnoreCase("admin"))
                    selc_1 = "selected='selected'";
                else if(layRole.getRole().equalsIgnoreCase("register"))
                    selc_2 = "selected='selected'";

%>
        

<div>
    <form action="/LaptopShop/EditUser?user=<%=user%>"  method="post">
    <table width="512" border="1" align="center">
        <caption>
        <strong>Sửa Role</strong> <strong> User</strong>
        </caption>
        <tr>
            <th width="170">Username</th>
            <td width="326"><%=user %></td>
        </tr>


        <tr>
            <th height="25">Họ Và Tên</th>
            <td><%=layRole.getFullname() %></td>
        </tr>
        <tr>
            <th>Role</th>
            <td>
                
            	<select id ="state" name="cbRole">                
                    <option value ="admin" <%=selc_1 %>>Admin</option>                    
                    <option value="register" <%=selc_2 %>>Register</option>                        
                </select>                
            </td>
        </tr>
        <tr>            
            <th colspan="2">
                <input type="submit" name="btCapNhat" value="Cap Nhat" onclick="return xacnhan()"/>
                <input type="hidden" name="update" value="update">
            </th>           
        </tr>
    </table>
    </form>
</div>
<%@include file="../WEB-INF/jspf/footeradmin.jspf" %>